﻿using System;
using System.Web.UI;
using PAS.Helper;

namespace PAS
{
    public partial class PeopleList : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void btnQuery_Click(object sender, EventArgs e)
        {
            string queryCodition = "";
            if (txtName.Text.Length > 0)
                queryCodition += ((queryCodition.Length == 0 ? " Where " : " And ") + PeopleInfo.DbName + " like '%" +
                                  txtName.Text + "%' ");
            if (txtGroupName.Text.Length > 0)
                queryCodition += ((queryCodition.Length == 0 ? " Where " : " And ") + PeopleInfo.DbGroupName +
                                  " like '%" + txtGroupName.Text + "%' ");

            sdList.InnerSql = "Select Id," + PeopleInfo.DbName + "," + PeopleInfo.DbGroupName + " From " +
                              PeopleInfo.DbTableName + queryCodition;
            sdList.SortExpress = PeopleInfo.DbGroupName + "," + PeopleInfo.DbName;
            sdList.ColumnTypes = new[] {"hidden", "text", "text"};
            sdList.ColumnMemos = new[] {"", "参与人姓名", "组别名称"};
            sdList.ColumnWidths = new[] {"", "120", "120"};
            sdList.KeyColumnName = "Id";
            sdList.DbTableName = PeopleInfo.DbTableName;
            sdList.PageSize = 20;
            sdList.BindData();
        }
    }
}